<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>表单操作</title>
</head>

<body>
    <h1>表单操作</h1>
    <form action="">
        <label for="username">用户名：</label>
        <input type="text" id="username">
        <br>
        <label for="telephone">电话：</label>
        <input type="text" id="telephone">
        <br>
        <fieldset>
            <legend>爱好</legend>
            <label for="a">吹牛</label>
            <input type="checkbox" id="a" name="fav">
            <label for="b">装逼</label>
            <input type="checkbox" id="b" name="fav">
        </fieldset>
    </form>
    <script>
        var usrenameIpt = document.getElementById('username')
        var telephoneIpt = document.getElementById('telephone')
        //设置input的值
        usrenameIpt.value = '叶良辰'
        //获取input的值
        usrenameIpt.value

        var aIpt = document.getElementById('a')
        //获取选中状态，选中为true，不选中为false
        aIpt.checked
        aIpt.checked
        //设置选中状态
        aIpt.checked = true
        true
        aIpt.checked = false
        false
    </script>
</body>

</html>